{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7bbfbe10",
   "metadata": {},
   "outputs": [],
   "source": [
    "### 1.[]添加、修改键值对\n",
    "例：\n",
    "```\n",
    "dict={} #空字典\n",
    "dict['name']='147'\n",
    "print(dict)\n",
    "```\n",
    "运行结果为打印出{'name':'147'}\n",
    "### 2.len()\n",
    "用来计算字典中一共有几个键值对，用法与列表中的相同\n",
    "### 3.如何通过键获取对应的值\n",
    "例：\n",
    "```\n",
    "dict={'name':'147'}\n",
    "print(dict['name'])\n",
    "```\n",
    "运行结果为打印出147\n",
    "### 4.keys（）\n",
    "获取所有的键，例：\n",
    "```\n",
    "dict={'name':'147','age':7}\n",
    "print(dict.keys())\n",
    "```\n",
    "运行结果为打印出dict.keys(['name','age'])\n",
    "### 5.values()\n",
    "获取所有的值，使用方法与keys（）相同\n",
    "### 6.items()\n",
    "获取所有的键和值（以列表形式），使用方法与keys（）相同\n",
    "### 7.updat（）\n",
    "添加或更新键值对，使用方法：字典名.updat({'height':'180'})\n",
    "### 8.del\n",
    "删除字典中的键值对，使用方法：\n",
    "del 字典名['键']\n",
    "### 9.pop（）\n",
    "取出某一键值对，取出的键值对可另外使用"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
